package hot.pay.utils;

import com.alibaba.fastjson.JSON;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class MethodUtils {



	/***
	 * list javabean convert 2 list map
	 * @param list
	 * @return
	 */
	public static List<Map<String, Object>> convertListBean2ListMap(List list) {
		List<Map<String, Object>> result = new ArrayList<>();
		for (Object object : list) {
			result.add(convertBean2Map(object));
		}
		return result;

	}


	/***
	 * javabean convert 2  map
	 * @param object
	 * @return
	 */
	public static Map<String, Object> convertBean2Map(Object object) {
		String json = JSON.toJSONString(object);
		return JSON.parseObject(json, Map.class);
	}


	public static Object convertMap2Bean(Map<String, Object> map,Class<?> clazz) {
		String json = JSON.toJSONString(map);
		return JSON.parseObject(json, clazz);
	}



}
